import { Menu, Affix } from 'antd';
import routes from '@/router/navRouter.js'
import { useParams, withRouter } from 'react-router-dom'
const TabBar = (props) => {
    let { type } = useParams();
    return (
        <Affix offsetTop={0}>
            <Menu
                theme="dark"
                mode="horizontal"
                defaultSelectedKeys={[type]}
                selectedKeys={[type]}
            >
                {
                    routes.map((item) => {
                        return (<Menu.Item key={item.type} onClick={() => props.history.push(`/home/${item.type}/1`)}> { item.name} </Menu.Item>)
                    })
                }
            </Menu>
        </Affix>
    );
}

export default withRouter(TabBar);